package com.cqw.controller;

import com.cqw.common.BaseResponse;
import com.cqw.service.SysLoginService;
import com.cqw.vo.LoginVO;
import io.swagger.annotations.Api;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Author: caoqingwen
 * @CreateTime: 2021-07-16 17:41
 * @Description: 登录
 */
@RestController
@RequestMapping
@Slf4j
@Api(tags = "登录API")
public class SysLoginController {


    @Autowired
    private SysLoginService loginService;

    @PostMapping("/login")
    public BaseResponse login(@RequestBody @Validated LoginVO loginVO) {
        String token = loginService.login(loginVO);
        return BaseResponse.success(token);
    }


}
